package com.crud.generator.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Collections;
import java.util.List;

/**
 * 批量生成结果。
 */
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BatchGenerationResponse {

    private int totalCount;

    private int successCount;

    private int failedCount;

    private boolean generateFiles;

    private String packagePrefix;

    private String author;

    private String projectName;

    private String projectDescription;

    private boolean enableRedis;

    private boolean enableSecurity;

    @Builder.Default
    private List<TableResult> successTables = Collections.emptyList();

    @Builder.Default
    private List<FailedTable> failedTables = Collections.emptyList();

    @Getter
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class TableResult {

        private String tableName;

        private String tableComment;

        private int columnCount;

        private String status;

        private String message;

        private CodePreviewBundle preview;
    }

    @Getter
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class FailedTable {

        private int index;

        private String identifier;

        private String error;
    }
}
